import 'package:flutter/material.dart';
import 'package:flutter_billi/util/color.dart';
import 'package:underline_indicator/underline_indicator.dart';

// 顶部切换组件
class HiTab extends StatelessWidget {
  final List<Widget> tabs;
  final TabController controller;
  final double fontSize;
  final double borderWidth;
  final double insets;
  final Color unselectedLabelColor;

  const HiTab(
    this.tabs, {
    Key key,
    this.controller,
    this.fontSize = 16,
    this.borderWidth = 2,
    this.insets = 13,
    this.unselectedLabelColor = Colors.grey,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return TabBar(
      tabs: tabs,
      isScrollable: true,
      labelColor: Colors.black,
      labelStyle: TextStyle(fontSize: fontSize),
      indicator: UnderlineIndicator(
          strokeCap: StrokeCap.square,
          borderSide: BorderSide(color: primay, width: borderWidth),
          insets: EdgeInsets.only(left: insets, right: insets)),
      controller: controller,
    );
    ;
  }
}
